<?php

$collect = is_object($collect) ? $collect : load('collect.class.php','collect');
switch($action){
		// 我的收藏
	default:
		if(!$_userid) showmessage('您还没有登陆，请登陆',url("?module=member&action=login&forward=".urlencode(URL)));
		$space = load('space.class.php', 'space');
		if(!$forward) $forward = HTTP_REFERER;
		$is_host = 1;
		$memberinfo = $member->get($_userid, '*', 1);
		$avatar = avatar($_userid);
		//$data = $space->get_collect($page);
		
		$data = $collect->listinfo();
		//return $data;
		
		include template('collect.html','member');
	break;

	case 'add':
		
		$info = array('module'=>$mod, 'field'=>$field, 'value'=> $value, 'userid'=>$_userid, 'addtime'=>TIME);
	 
		if($collect->add($info)){
			showmessage('收藏成功！', HTTP_REFERER);
		}
		else{
			showmessage($collect->msg, HTTP_REFERER);
		}
	break;

	case 'delete':
		$id = intval($id);
		if(!$id) showmessage('非法操作！', HTTP_REFERER);
		$collect->delete("`id`='$id'");
		showmessage('删除成功！', HTTP_REFERER);
	break;
}
?>